﻿using FluentValidation;
namespace AppServer.Implement.Socket
{
    internal class SocketConfigValidator:AbstractValidator<SocketConfig>
    {
        public SocketConfigValidator()
        {
            RuleFor(m => m.MaxSessionCount).GreaterThan(0).WithMessage("最大Session数不能小于1");
            RuleFor(m => m.KeepLive).SetValidator(new KeepLiveArgsValidator());
        }

        class KeepLiveArgsValidator : AbstractValidator<SocketConfig.KeepLiveArgs>
        {
            public KeepLiveArgsValidator()
            {
                RuleFor(m => m.MilliSeconds).GreaterThan(2999).WithMessage("KeepLive间隔时间不能小于3000毫秒");
            }
        }
    }
}
